
export function uploadFile(filePath) {
    return new Promise((resolve, reject) => {
        uni.uploadFile({
            url: 'http://localhost:8080/file/upload', // 上传图片的后端接口
            filePath: filePath,
            name: 'file',
            success: (res) => {
                console.log("文件上传", res.data);
                resolve(JSON.parse(res.data));
            },
            fail: (err) => {
                console.error('文件上传失败:', err);
                reject(err);
            }
        });
    });
}